/*
 * Copyright (c) 2017-present, CV4J Contributors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.cv4j.core.spatial.conv;

import com.cv4j.core.datamodel.ImageProcessor;
import com.cv4j.core.filters.BaseFilter;
import com.cv4j.uitl.Log;

import java.util.Optional;

/**
 * sobel过滤器
 *
 * @author dev
 * @date 2021/07/22
 */
public class SobelFilter extends BaseFilter {
    /**
     * sobel y
     */
    public static int[] sobel_y = new int[]{-1, -2, -1, 0, 0, 0, 1, 2, 1};
    /**
     * 索贝尔x
     */
    public static int[] sobel_x = new int[]{-1, 0, 1, -2, 0, 2, -1, 0, 1};
    /**
     * xdirect
     */
    private boolean xdirect;

    /**
     * sobel过滤器
     */
    public SobelFilter() {
        xdirect = true;
    }

    /**
     * 是xdirect
     *
     * @return boolean
     */
    public boolean isXdirect() {
        return xdirect;
    }

    /**
     * 设置xdirect
     *
     * @param xdirect xdirect
     */
    public void setXdirect(boolean xdirect) {
        this.xdirect = xdirect;
    }

    /**
     * 做的过滤器
     *
     * @param src src
     * @return {@link Optional<ImageProcessor>}
     */
    @Override
    public Optional<ImageProcessor> doFilter(ImageProcessor src) {
        Log.debug("debug","more code...");
        return Optional.ofNullable(src);
    }
}
